package cn.edu.zafu.bigdata.x.wupeng.b;
import cn.edu.zafu.bigdata.x.bd121.course.Course;

public class School {
    private String name;
    private String location;
    private Course course;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = formatName(name);
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
        doubleCredit(course);
    }

    public School() {
    }

    public School(String name, String location) {
        this.name = name;
        this.location = location;
    }

    @Override
    public String toString() {
        return "School{" +
                "name='" + name + '\'' +
                ", location='" + location + '\'' +
                ", course credit ='" + course.getCredit() + '\'' +
                '}';
    }

    String formatName(String name){
        name=name.trim();
        return name;
    }
    private void doubleCredit(Course course){
        course.setCredit(course.getCredit()*2);
    }
}
